﻿using Comm100.Framework.Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bot.Domain.Entities;
using Bot.Domain.Interfaces;
using Bot.Domain.Bo;
using Castle.Windsor;
using Bot.Domain.Specifications;

namespace Bot.Domain.Categories.Service
{
    public class AgentAssistSynonymKeywordDomainService : ISynonymKeywordDomainService
    {
        private IWindsorContainer _container;
        private readonly IRepository<Guid, SynonymKeyword> _repository;

        public AgentAssistSynonymKeywordDomainService(IRepository<Guid, SynonymKeyword> repository, IWindsorContainer container)
        {
            this._repository = repository;
            this._container = container;
        }

        public SynonymKeyword Create(SynonymKeyword synonym)
        {
            return _repository.Create(synonym);
        }

        public SynonymKeyword Get(Guid id)
        {
            return _repository.Get(id);
        }

        public SynonymKeyword Update(SynonymKeywordUpdateBo bo)
        {
            SynonymKeyword synonymKeyword = _repository.Get(bo.Id);
            //synonymKeyword.Id = bo.Id;
            //synonymKeyword.SiteId = bo.SiteId;
            synonymKeyword.Content = bo.Content;
            synonymKeyword.Synonyms = bo.Synonyms;
            //synonymKeyword.IsDeleted = bo.IsDeleted;

            return synonymKeyword;

        }

        public IEnumerable<SynonymKeyword> List()
        {
            return _repository.ListAll();
        }

        //public IEnumerable<SynonymKeyword> GetBySiteId(int siteId)
        //{
        //    return _repository.List(new AgenAssistSynonymKeywordFilterSpecification(siteId));
        //}

        public void Delete(Guid id)
        {
            if (_repository.Exists(id))
            {
                SynonymKeyword synonymKeyword = _repository.Get(id);

                _repository.Delete(synonymKeyword);
            }

        }
    }
}
